#include "BeaconRanging.h"
#include "SingleRanging.h"
#include "TripleRanging.h"

double BeaconRanging::Ranging(const std::vector<double>& beaconRSSI)
{
	return SelectRanging(beaconRSSI)->Ranging(beaconRSSI);
}

/// <summary>
/// 根据信标设备数量选择不同的算法策略
/// </summary>
/// <param name="beaconRSSI"></param>
/// <returns></returns>
std::shared_ptr<IRanging> BeaconRanging::SelectRanging(const std::vector<double>& beaconRSSI)
{
	if (beaconRSSI.size() >= 3)
		return std::shared_ptr<IRanging>(new TripleRanging());
	
	return std::shared_ptr<IRanging>(new SingleRanging());
}
